package pailiewu.util;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class Summary {
	private Count3 count3;
	private Sort sort;

	public Summary(Count3 count3, Sort sort) {
		this.count3 = count3;
		this.sort = sort;
	}

	public void summary(String summaryStr) throws IOException {
		FileWriter fw = new FileWriter(summaryStr);
		BufferedWriter bw = new BufferedWriter(fw);

		bw.write("minLine");
		bw.newLine();
		bw.write(this.sort.getMinLine());
		bw.newLine();
		bw.write("***************************************************************");
		bw.newLine();

		bw.write("maxLine");
		bw.newLine();
		bw.write(this.sort.getMaxLine());
		bw.newLine();
		bw.write("***************************************************************");
		bw.newLine();

		bw.write("maxMod");
		bw.newLine();
		int maxMod = count3.getMaxMod();
		for (int i = 0; i < 1000; i++) {
			if (count3.getCount3ModList()[i] == maxMod) {
				String line = Count3.getIndex(i);

				line = line + "\t" + count3.getCount3List()[i] + "\t" + count3.getCount3AverageList()[i] + "\t" + count3.getCount3LastList()[i]+"\t" + count3.getCount3ModList()[i];
				System.out.println(line);
				bw.write(line);
				bw.newLine();
			}
		
		}
		bw.write("***************************************************************");
		bw.close();

	}


}